package com.company.practice;

import sun.misc.VM;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;

/**
 * @description: OOM: direct buffer memory
 *
 * @author: ruoan
 * @date: 2021/1/5 21:22
 */
public class OOMDemo2 {

    public static void main(String[] args) {

        System.out.println(
                VM.maxDirectMemory() /1024/1024 + "MB"); //打印JAVA可以触碰到的本地物理内存。
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(6 * 1024 * 1024);  // 6M > 5M


    }


}
